﻿using DadayunApi.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace KhtApi.Model
{
    /// <summary>
    /// 产品信息报表
    /// 报表名称：产品信息查询
    /// </summary>
    public class ProductReport
    {
        public List<ProductRepTpl> Results { get; set; }
    }
    /// <summary>
    /// 供ProductReport用的产品信息报表模板
    /// </summary>
    public class ProductRepTpl
    {
        public int RowNum { get; set; }
        public ReportDataObject DataObjs { get; set; }

        [JsonProperty(PropertyName = "产品编码", NullValueHandling = NullValueHandling.Ignore)]
        public string ItemCode { get; set; }

        [JsonProperty(PropertyName = "产品名称", NullValueHandling = NullValueHandling.Ignore)]
        public string Name { get; set; }

        [JsonProperty(PropertyName = "型号", NullValueHandling = NullValueHandling.Ignore)]
        public string ModelNo { get; set; }

        [JsonProperty(PropertyName = "规格", NullValueHandling = NullValueHandling.Ignore)]
        public string Spec { get; set; }

        [JsonProperty(PropertyName = "加工成本", NullValueHandling = NullValueHandling.Ignore)]
        public double? Cost { get; set; }

        [JsonProperty(PropertyName = "产品来源", NullValueHandling = NullValueHandling.Ignore)]
        public string OriginCn { get; set; }

        [JsonProperty(PropertyName = "大类", NullValueHandling = NullValueHandling.Ignore)]
        public string Catagory1 { get; set; }

        [JsonProperty(PropertyName = "中类", NullValueHandling = NullValueHandling.Ignore)]
        public string Catagory2 { get; set; }

        [JsonProperty(PropertyName = "小类", NullValueHandling = NullValueHandling.Ignore)]
        public string Catagory3 { get; set; }

        [JsonProperty(PropertyName = "单位", NullValueHandling = NullValueHandling.Ignore)]
        public string Unit { get; set; }

        [JsonProperty(PropertyName = "是否固定资产", NullValueHandling = NullValueHandling.Ignore)]
        public string IsFixedAsset { get; set; }

        public ProductInfo ToProductInfo()
        {
            ProductInfo product = new ProductInfo
            {
                Catagory1 = Catagory1,
                Catagory2 = Catagory2,
                Catagory3 = Catagory3,
                Cost = Cost,
                ItemCode = ItemCode,
                ModelNo = ModelNo,
                Name = Name,
                OriginCn = OriginCn,
                Spec = Spec,
                Unit = Unit
            };
            return product;
        }
    }
}
